<extend name="Public:base"/>

<!--侧边导航-->
<block name="aside">
    <include file="Public:aside"/>
</block>

<block name="main">

    <div class="table-toolbar">
        <div class="row">
            <div class="col-md-12">
                <a class="btn btn-primary" href="{:U('Link/add')}">新增</a>
                <a class="btn btn-primary" onclick="return confirm_deleteall()">删除</a>
                <a class="btn btn-primary" onclick="myform.action='{:U('Link/listorder')}';$('#myform').submit();" >排序</a>
            </div>
         </div>
    </div>

    <div class="row table-container">
        <div class="col-md-12">
            <form name="myform" id="myform" action="" method="post">
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th width="20"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');"></th>
                        <th class="table-cell-1">排序</th>
                        <th width="40">ID</th>
                        <th>名称</th>
                        <th>网站地址</th>
                        <th>logo</th>
                        <th class="table-cell-3">添加时间</th>
                        <th class="table-cell-2 center">管理操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <empty name="list">
                        <tr class="table-data-empty">
                            <td class="text-center empty-info" colspan="8">
                                <i class="fa fa-database"></i> 暂时没有数据<br>
                            </td>
                        </tr>
                        <else/>
                        <volist name="list" id="vo" key="k">
                            <tr>
                                <td width="20" align="center"><input class="inputcheckbox " name="ids[]" value="{$vo['id']}" type="checkbox" ></td>
                                <td width="30"><input name='listorders[{$vo.id}]' type='text' size='3' value='{$vo.listorder}' class='input-text-c'></td>
                                <td>{$vo['id']}<input class="id" type="hidden" name="id" value="{$vo['id']}"></td>
                                <td>{$vo['name']}</td>
                                <td>{$vo['siteurl']}</td>
                                <td><if condition="$vo['weblogo']"><img src="{$vo['weblogo']}" height=26></if>&nbsp;</td>
                                <td align="center">{$vo['createtime']|todate="Y-m-d H:i:s"}</td>
                                <td class="table-cell-2 center">
                                    <a class="btn btn-xs btn-primary" href="{:U('Link/edit',array('id'=>$vo['id']))}">编辑</a>
                                    <a class="btn btn-xs btn-danger" href="javascript:confirm_delete('{:U('Link/delete',array(id=>$vo['id']))}')">删除</a>
                                </td>
                            </tr>
                        </volist>
                    </empty>
                    </tbody>
                </table>
            </form>
            <div id="pages">{$page}</div>
        </div>

    </div>
</div>
<script>
// 确认删除
function confirm_deleteall(){
    var str = 0;
    var id = tag = '';
    $('input[name="ids[]"]:checked').each(function(){
        str = 1;
        id += tag + $(this).val();
        tag = ',';
    });
    if (str == 0) {
        layer.msg('您没有勾选信息，无法进行操作！', {
            icon: 2,
            time: 1000 //2秒关闭（如果不配置，默认是3秒）
        });
        return false;
    }
    layer.confirm("{:L('real_delete')}", function(){
        myform.action='{:U('Link/delete')}'+'&id='+id;
        $('#myform').submit();
    });
}
</script>
</block>